require(['./config'],()=>{
    require(['template','header','footer'],(template)=>{
           class List{
               constructor(){
               this.getList()
			   // this.sort()
               }
               getList(){
                $.get('/libs/json/detalis.json',resp=>{
                    console.log(resp)
                    this.renderList(resp)
					this.sort(resp)
                })
               }
               renderList(list){
               const  data=  template('listTe',{list})
              $('#DL').html(data)
               }
			   
			   //价格排序
			  sort(list){
				$('#price1').on('click',()=>{
				  var arr = list.sort(function(a,b){
					  var price1 = a.price
					  var price2 = b.price
					  if(price1 > price2) return 
					  if(price1 < price2) return -1
					  return 0
				  })
				 $('#DL').html(template('listTe',{list:arr}))
				  return false
				})
			  }
           }
           new List()
    })
})